package com.ishopping.service.manage.mapper;

import java.util.List;

import com.github.abel533.mapper.Mapper;
import com.ishopping.api.manage.entity.UserRole;
import org.apache.ibatis.annotations.Param;

public interface UserRoleMapper extends Mapper<UserRole> {

    /**
     * 通过userId获取用户角色
     * @param userId
     * @return List<Long>
     */
    List<UserRole> queryUserRolesByUserId(Long userId);

    /**
     * 通过userId删除其关联的角色
     * @param userId
     * @return int
     */
    int deleteByUserId(Long userId);

    /**
     * 批量插入用户关联的角色
     * @param list
     * @param userId
     * @return int
     */
    int batchInsert(@Param("userId") Long userId, @Param("roleIdList") List<Long> list);
}